<?php

/**
 * @name ConnectioManager.class.php
 * @desc Gestiona la conexion a la base de datos
 */
class ConnectionManager {

    var $cnx;
    var $host;
    var $user;
    var $passwd;
    var $dbName;

    public function getCnx() {
        return $this->cnx;
    }

    public function setCnx($cnx) {
        $this->cnx = $cnx;
    }

    public function getHost() {
        return $this->host;
    }

    public function setHost($host) {
        $this->host = $host;
    }

    public function getUser() {
        return $this->user;
    }

    public function setUser($user) {
        $this->user = $user;
    }

    public function getPasswd() {
        return $this->passwd;
    }

    public function setPasswd($passwd) {
        $this->passwd = $passwd;
    }

    public function getDbName() {
        return $this->dbName;
    }

    public function setDbName($dbName) {
        $this->dbName = $dbName;
    }

    function __construct() {
        $this->host = DB_HOST;
        $this->user = DB_USER;
        $this->passwd = DB_PASSWD;
        $this->dbName = DB_NAME;
        $this->cnx = mysql_connect($this->host, $this->user, $this->passwd) or die("No se pudo conectar a la base");
        mysql_select_db($this->dbName, $this->cnx) or die("No se pudo selecionar la db");
    }

    public function getConnection() {
        return $this->getCnx();
    }

}

?>
